package main

import (
	"github.com/nntaoli-project/goex"
	//"quantization_trading/external/goex"
	"time"
)

type  Sub struct {
	Method string `json:"method"`
	Params []string `json:"params"`
	Id int `json:"id"`
}
func ProtoHandle(data []byte)error{
	println(string(data))
	return nil
}
func main() {
	ws := goex.NewWsBuilder().WsUrl("wss://fstream.binance.com/ws").ProtoHandleFunc(ProtoHandle).Build()
	sub := Sub{
		Method: "SUBSCRIBE",
		Params: []string{"btcusdt@aggTrade"},
		Id: 1,
	}
	ws.Subscribe(sub)
	time.Sleep(time.Second * 30)
	ws.CloseWs()
	time.Sleep(time.Second * 30)
}
